package action;

import java.util.List;

import org.apache.struts.action.*;

import dao.TUserDao;
import entity.TUser;

import bean.UserListForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserListAction extends Action {

    public ActionForward execute(ActionMapping map, ActionForm frm,
            HttpServletRequest request, HttpServletResponse response) {    
    
        UserListForm userList = (UserListForm)frm;
        
        List<TUser> allUser = TUserDao.getAllUser();
        
        // TODO null のときの処理を変更
        if (allUser != null) {
            userList.setAllUser(allUser);
            request.setAttribute("userList", userList);
            return map.findForward("success");
        }
        else {
            return map.findForward("error");
        }
        
    }
}
